<template>
	<!-- 小程序的布局组件  view text image等
	 不能写 div  h1 h2 等-->
	<view class="content">
		<swiper class="mybanner">
			<swiper-item v-for="item in bannerList" >
				<image :src="item.picUrl" ></image>
			</swiper-item>
		</swiper>
	</view>
</template>

<script setup>

  import {getHomeBanner} from '@/api/home'
    import {ref} from 'vue'
  import {onLoad} from '@dcloudio/uni-app'  //默认小程序的用法
  let bannerList=ref([])
  let getBanner=async ()=>{
	  let res=await getHomeBanner({type:"index"})
	  console.log(res)
	  bannerList.value=res.data;
	  uni.showToast({
	  	title:"获取banner成功"
	  })
  }
  getBanner();
  onLoad(()=>{
	  console.log("加载完成")
  })
</script>

<style lang="scss">
		.mybanner{
			width: 100%;
			height: 300rpx;
			image{
				width: 100%;
				height: 300rpx;
			}
		}
</style>
